Skip to content

test(cli): add test for post confirmation trigger in store-locator app#14834

Merged
iliapolo merged 2 commits intodevfrom
sai/postconfirmation-trigger-test
May 8, 2026
Merged

test(cli): add test for post confirmation trigger in store-locator app#14834
iliapolo merged 2 commits intodevfrom
sai/postconfirmation-trigger-test

Conversation

@sai-ray
Copy link
Copy Markdown
Contributor

@sai-ray sai-ray commented Apr 30, 2026

Description of changes

This PR adds a test that validates the PostConfirmation Cognito trigger for store-locator. A user who signs up and gets confirmed should land in the storeLocatorAdmin group via the migrated Lambda. The test runs at every test:gen1 and test:gen2 phase, exercising the trigger on both the Gen1 pool and the Gen2 post-refactor pool.

The trigger only fires on the real SignUp + AdminConfirmSignUp flow, which requires AllowAdminCreateUserOnly: false on the user pool. The test detects the current value, flips to false for the test run if needed, and restores the original value in afterAll.

Cognito's UpdateUserPool resets any omitted field to its default, so the test follows the AWS-documented pattern of DescribeUserPool → copy all safe fields → override just AdminCreateUserConfig.AllowAdminCreateUserOnlyUpdateUserPool to avoid clobbering unrelated pool settings.

Issue #, if available

Description of how you validated changes

  • Full e2e run on store-locator passed end-to-end: 8 invocations of tests/auth.test.ts across all test:gen1 / test:gen2 phases (pre/post sandbox and pre/post refactor), plus the existing shared-auth.test.ts at the end. No regressions to other tests.

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Comment thread amplify-migration-apps/store-locator/tests/auth.test.ts Fixed
Comment thread amplify-migration-apps/store-locator/tests/auth.test.ts Fixed
@sai-ray sai-ray changed the title test(gen2-migration): add test for post confirmation trigger in store-locator app test(cli): add test for post confirmation trigger in store-locator app May 8, 2026
@sai-ray sai-ray marked this pull request as ready for review May 8, 2026 17:22
@sai-ray sai-ray requested a review from a team as a code owner May 8, 2026 17:22
@iliapolo iliapolo enabled auto-merge (squash) May 8, 2026 18:09
@iliapolo iliapolo merged commit 6f12bec into dev May 8, 2026
5 checks passed
@iliapolo iliapolo deleted the sai/postconfirmation-trigger-test branch May 8, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants